<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
		<infopost-request>
			<xsl:for-each select="FEEDAYCHECK">
				<request-head>
					<trans-id>
						<xsl:value-of select="MAIN/TRANSRNO" />
					</trans-id>
					<insu-id>
						<xsl:value-of select="MAIN/INSUID" />
					</insu-id>
					<trans-type>801</trans-type>
					<trans-date>
						<xsl:value-of select="MAIN/TRANSRDATE" />
					</trans-date>
					<trans-time>
						<xsl:value-of select="MAIN/TRANSRTIME" />
					</trans-time>
					<bank>210</bank>
					<area />
					<branch />
					<post />
					<agency-hand />
					<authorized />
				</request-head>
				<request-checkbill>
					<check-date>
						<xsl:value-of select="MAIN/CHECKDATE" />
					</check-date>
					<client-total-count>
						<xsl:value-of select="MAIN/TOTALCOUNT" />
					</client-total-count>
					<client-total-premium>
						<xsl:value-of select="format-number(MAIN/TOTALPREMIUM div 100,'############.00') " />
					</client-total-premium>
					<check-trans-list>
						<xsl:for-each select="DAYCHECK_DETAILS/DAYCHECK_DETAIL">
							<check-trans>
								<sequence>
									<xsl:value-of select="sequence" />
								</sequence>
								<trans-date>
									<xsl:value-of select="trans-date" />
								</trans-date>
								<trans-time>
									<xsl:value-of select="trans-time" />
								</trans-time>
								<trans-id>
									<xsl:value-of select="trans-id" />
								</trans-id>
								<trans-area>
									<xsl:value-of select="trans-area" />
								</trans-area>
								<ph-name>
									<xsl:value-of select="ph-name" />
								</ph-name>
								<apply-code>
									<xsl:value-of select="apply-code" />
								</apply-code>
								<policy-code>
									<xsl:value-of select="policy-code" />
								</policy-code>
								<premium>
									<xsl:value-of select="format-number(premium div 100,'############.00')" />
								</premium>
								<agency-hand>
									<xsl:value-of select="agency-hand" />
								</agency-hand>
								<xsl:choose>
									<xsl:when test="trans-type = 580001">
										<trans-type>102</trans-type>
									</xsl:when>
									<xsl:when test="trans-type = ''">
										<trans-type />
									</xsl:when>
									<xsl:otherwise>
										<trans-type>CODE_NOT_EXIST</trans-type>
									</xsl:otherwise>
								</xsl:choose>
							</check-trans>
						</xsl:for-each>
					</check-trans-list>
				</request-checkbill>
			</xsl:for-each>
		</infopost-request>
	</xsl:template>
	<xsl:template name="GenderCode">
		<xsl:param name="srcCode" />
		<xsl:choose>
			<xsl:when test="$srcCode = 1">
				<gender>M</gender>
			</xsl:when>
			<xsl:when test="$srcCode = 2">
				<gender>F</gender>
			</xsl:when>
			<xsl:when test="$srcCode = 3">
				<gender>N</gender>
			</xsl:when>
			<xsl:when test="$srcCode = ''">
				<gender />
			</xsl:when>
			<xsl:otherwise>
				<gender>CODE_NOT_EXIST</gender>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="CertiTypeCode">
		<xsl:param name="srcCode" />
		<xsl:choose>
			<xsl:when test="$srcCode = 1">
				<certi-type>1</certi-type>
			</xsl:when>
			<xsl:when test="$srcCode = 7">
				<certi-type>7</certi-type>
			</xsl:when>
			<xsl:when test="$srcCode = 2">
				<certi-type>2</certi-type>
			</xsl:when>
			<xsl:when test="$srcCode = 3">
				<certi-type>3</certi-type>
			</xsl:when>
			<xsl:when test="$srcCode = 4">
				<certi-type>4</certi-type>
			</xsl:when>
			<xsl:when test="$srcCode = 5">
				<certi-type>9</certi-type>
			</xsl:when>
			<xsl:when test="$srcCode = 6">
				<certi-type>6</certi-type>
			</xsl:when>
			<xsl:when test="$srcCode = ''">
				<certi-type />
			</xsl:when>
			<xsl:otherwise>
				<certi-type>CODE_NOT_EXIST</certi-type>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="EducationId">
		<xsl:param name="srcCode" />
		<xsl:choose>
			<xsl:when test="$srcCode = 1">
				<column3>8</column3>
			</xsl:when>
			<xsl:when test="$srcCode = 2">
				<column3>9</column3>
			</xsl:when>
			<xsl:when test="$srcCode = 3">
				<column3>7</column3>
			</xsl:when>
			<xsl:when test="$srcCode = 4">
				<column3>5</column3>
			</xsl:when>
			<xsl:when test="$srcCode = 5">
				<column3>4</column3>
			</xsl:when>
			<xsl:when test="$srcCode = 6">
				<column3>10</column3>
			</xsl:when>
			<xsl:when test="$srcCode = 7">
				<column3>2</column3>
			</xsl:when>
			<xsl:when test="$srcCode = 8">
				<column3>3</column3>
			</xsl:when>
			<xsl:when test="$srcCode = 9">
				<column3>11</column3>
			</xsl:when>
			<xsl:when test="$srcCode = 0">
				<column3>0</column3>
			</xsl:when>
			<xsl:when test="$srcCode = ''">
				<column3 />
			</xsl:when>
			<xsl:otherwise>
				<column3>CODE_NOT_EXIST</column3>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
